package demo.domain;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;


// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    static long[] dp = new long[100001];
    static int[] father = new int[100001];
    static int[] sum = new int[100001];


    /**
     * 查询公共的祖先
     *
     * @param x
     * @return
     */
    public static int find(int x) {
        if (father[x] == x) {
            return x;
        }
        father[x] = find(father[x]);
        return father[x];
    }

    public static void merge(int a, int b) {
        a = find(a);
        b = find(b);
        if (a == b) {
            return;
        }
        // 如果二者属于同一集合。同一往小的集合
        if (a > b) {
            father[a] = b;
            sum[b] += sum[a];
        } else {
            father[b] = a;
            sum[a] += sum[b];
        }
    }

    public static void merge(int m) {
        // 使用并查集，完成
        for (int i = 0; i < m; i++) {
            //
        }
    }

    public static void main(String[] args) {
        Thread childThread = new Thread(() -> {
            try {
                Thread.sleep(3000);
                System.out.println("子线程执行完成");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });

        childThread.start();
        System.out.println("主线程结束");
    }
}